can you create a nonclustered index on temp table
like
CREATE NONCLUSTERED INDEX NCIDX_KW_ID
ON #temp_6675(KW_ID)
drop the index at the end of the statement. and try whether it works...
also refer BOL like : ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/39123830-dc95-4b15-a582-3b43edb400bc.htm