SESSION_CONTEXT()

Session context
- It is a stateful dictionary retaining state for the lifetime of the connection.
- Vast improvement of CONTEXT_INFO
- Used to share data accross stored procedures
- It is stored in memory and it stays there as long the SQL Server connection is being alive
- The value can be declared as "read-only" => the value cannot be changed along the current connection

Store a value in the session context:

EXEC sp_set_session_context @key = N'MyKey' , @value=N'MyValue'

Read a value from the session context:

SESSION_CONTEXT(N'MyKey')

Is this useful?