Here is a simple to create and drop temp tables:
to think that ALL temp tables reside in tempdb database, not releated to the user database at all, and it’s same for Global temp tables (##temp) which is why this would work in any User database.
IF OBJECT_ID(‘tempdb.dbo.#tempTable’) IS NOT NULL
DROP TABLE #tempTable
CREATE TABLE #tempTable (id smallint)