Custom connection properties or session contexts are not native to the SQL server world.
There is no information in your question about whether you are using a connection pool or not in your application. But if you have a pool, there is no guarantee that when two commands are executed, they will use the same physical connection (another .NET application thread can request a new connection and can get a connection from the pool previously used in the first thread, at the same time, the first thread will want to open a connection and will actually receive a second connection).
With a connection pool, a βsession context" is what you need to monitor only at the application level. If you have a desktop application, you have a workaround: you can create a table in which you will have the hostnames and additional properties associated with each hostname (but we must assume that each client will start only one session). However, in web applications there is no easy answer.
Usually, if you want to implement logging using triggers, you need to work with existing variables, that is, the host name, username, application name, session identifier, time date.
I believe that if your application has some properties that are logically related to user sessions (for example, an ASP.NET session), you can assign each new GUID session and write this GUID and some other permanent (not temporary!) Table and all The custom properties you want to use for logging. Then, add a GUID column to all important tables and force the code to populate the GUID column for all changed / inserted rows. In this case, you can use this GUID and all context data in triggers.
Another way is to use stored procedures for updates / deletes and the presence of an additional GUID parameter there and the implementation of logical protocols directly in stored procedures (so you will not need to add an additional column to all tables, brrrr)
But think again, if you really need all the logical staff to work at the database level? Why not register with business applications or the data layer? Consider that some of your clients may redirect file entries instead of databases to improve performance. If you are doing logging using Log4Net or even using Diagnostics.Trace, redirecting log output is just a configuration issue, but not a redesign of the entire system. And if you want to have logs in SQL tables, for example for reports, write the logs to a file in CSV format, and then use some task to import this data to the SQL server and run this task at night (or when the server is less active).