SQL @@SPID is one of the Configuration Functions, which will return the session ID that is currently used. The syntax behind this is
@@SPID
SQL @@SPID Example
The below code snippet will show the @@SPID and the respective login name that is currently being used.
SELECT @@SPID AS 'SP ID', SYSTEM_USER AS 'Login Name', USER AS 'User Name';

Let us use another SQL Server login to enter into Management Studio. Now, you can see that it is displaying a different @@SPID and login name.

If you don’t know the list of available users and their IDs, then use the sp_who system stored procedure.
