Does Microsoft SQL Server offer an Advisory Locks feature like Postgres? In Postgres, the Advisory Locks feature provides for arbitrary application-defined locks to be administered centrally in the database server. These locks are not related to tables or rows or such.

Does Microsoft SQL Server offers something like these Advisory Locks?
Application locks. They are arbitrary locks held by the engine on behalf of the app. Acquired with sp_getapplock and released with sp_releaselock (if needed). Shared, Update, Exclusive and intent modes with the usual compatibility matrix. Can have transaction or session scope. The behavior matches the PG advisory locks in every aspect, but is a stored procedure, not a function (so it cannot be used inline in a SELECT, for instance).