Hi Dave,
That would be expected. The temp table will continue to be available until it is dropped or the connection is closed.
This behavior lets a Stored Procedure create and populate a temp table that is then available to further query at a later time if needed (i.e. another sql statement or another stored procedure)
There are two possibilities.
A) Use a TRY/CATCH block to create the table / delete the contents
TRY
Create table #tempSVGM ....
CATCH ALL
delete from #tempSVGM...
END TRY
B) Use an if exists with sp_GetTables
if exists execute procedure sp_GetTables(null, null, 'tempSVGM', 'LOCAL TEMPORARY').....
(I've not had a chance to try B, but I'm confident it would work).
Edgar