SQL Server: Query that lists user permissions
This query lists the permissions of the connected user has on the database.
This function is available since SQL Server 2008. It can retrieve a lot of interesting information, see the Microsoft documentation page about it