Is it possible to rename a temporary table?
create table #t (id integer);
execute tempdb.sys.sp_rename '#t', '#s';
An invalid parameter or option was specified for procedure 'sys.sp_rename'
The proposed solution by @Michel, inserting into another temp table and dropping the original, works but I guess how expensive it is.
Tempdb doesn’t have the sp_rename procedure. What you could do is to create a new temptable with the contents of your old one
Something like this