By using the function “fn_my_permissions()” we can fetch the permissions that a login has at server level and at database level. This function returns a list of the permissions effectively granted to the principal on a securable.
fn_my_permissions ( securable , 'securable_class')
Fetching what permissions does a login has at Server level:
SELECT * FROM fn_my_permissions(NULL, 'SERVER');
Fetching what permissions does a user has at Database level:
SELECT * FROM fn_my_permissions(NULL, 'DATABASE');