Find the column names of Temp table
To get only columns name you can use this query below:
SELECT *
FROM tempdb.sys.columns
WHERE [object_id] = OBJECT_ID(N'tempdb..#temp');
To get columns name with data type you can use this query but you need to make sure sp_help runs in the same database where the table is located (tempdb).
EXEC tempdb.dbo.sp_help @objname = N'#temp';
you can achieve same result by joining against tempdb.sys.columns like below:
SELECT [column] = c.name,
[type] = t.name, c.max_length, c.precision, c.scale, c.is_nullable
FROM tempdb.sys.columns AS c
INNER JOIN tempdb.sys.types AS t
ON c.system_type_id = t.system_type_id
AND t.system_type_id = t.user_type_id
WHERE [object_id] = OBJECT_ID(N'tempdb.dbo.#temp');
SELECT *
FROM tempdb.sys.columns
WHERE object_id = Object_id('tempdb..#sometemptable');