We\'re maintaining (and occasionally debugging) a large in-house system. The system has 20+ databases, and a number of servers interfacing to other systems, processing data,
If you prefix a temporary table name with two octothorpes, e.g. ##mystuff, it creates a global temporary table that exists outside session scope.
##mystuff
That does require you to be able to alter the query text, which may or may not be accessible in this specific case.