Is it possible to get the name of the current Stored Procedure in MS SQL Server?
Maybe there is a system variable or function like GETDATE()?
In the specific case where you are interested in the name of the currently executing temporary stored procedure, you can get it via:
select name
from tempdb.sys.procedures
where object_id = @@procid
You cannot use the accepted answer in SQL Server to find the name of the currently executing temporary stored procedure:
create procedure #p
as
select object_name(@@PROCID) as name
go
exec #p
name
--------------------------------------------------------------------------------------------------------------------------------
NULL
(1 row affected)