Drop temp table if it exists
The following will delete a temp table if it exists.
IF (OBJECT_ID(N'tempdb..#temptable', N'U') IS NOT NULL) DROP TABLE #temptable;
The following will delete a temp table if it exists.
IF (OBJECT_ID(N'tempdb..#temptable', N'U') IS NOT NULL) DROP TABLE #temptable;