How to check programmatically which replica I'm connected to I have an AlwaysOn Availability Group on MS-SQLServer (2 replicas) and a C# application which sends queries to the Availability Group Listener.

How can I check which replica is responding my queries?

I know it's possible, because I've seen it in MS educational videos.

Thank you in advance
You can run SELECT @@SERVERNAME which will give you the current servername you are connected to.  Would this suit your requirements?