SQL @@SPID is one of the Configuration Functions, which will return the session ID that currently used. Syntax behind this is
SQL @@SPID Example
The below code snippet will show the SP ID and their respective login name that is currently being used by SQL.
SELECT @@SPID AS 'SP ID', SYSTEM_USER AS 'Login Name', USER AS 'User Name';
Let us use another SQL Server login to enter into SQL Server Management Studio. Now, you can see, it is displaying different SP ID, and login name
If you don’t know the list of available users and their IDs, then use sp_who system stored procedure.