Why creating the tables.. sometimes you just do your temptable like this:
select distinct CONVERT(nvarchar(30), (KO.a)) AS a,
CONVERT(nvarchar(30), (KO.b)) AS b,
Navn AS Name
into#MyTempTable
fromTable 1KO
INNER JOINTable 2KU
ONKO.NR = KU.NR
You avoid writting all these creates etc.. and - if it is inside a SP then it gets flushed automatically