Returns the stored procedure identifier (ID) of the current procedure.
@@PROCID
integer
This example creates a procedure that uses SELECT to display the @@PROCID setting from inside the procedure.
CREATE PROCEDURE testprocedure AS
SELECT @@PROCID AS 'ProcID'
GO
EXEC testprocedure
GO