if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#TEMP')) drop table #TEMPtable