I am looking for a t-sql script which can list the databases and and the respective roles/privileges mapped for a particular user. Using SQL Server 2008 R2.
Is this the kind of thing you want? You might want to extend it to get more info out of the sys tables.
use master
DECLARE @name VARCHAR(50) -- database name
DECLARE db_cursor CURSOR FOR
select name from sys.databases
OPEN db_cursor
FETCH NEXT FROM db_cursor INTO @name
WHILE @@FETCH_STATUS = 0
BEGIN
print @name
exec('USE ' + @name + '; select rp.name, mp.name from sys.database_role_members drm
join sys.database_principals rp on (drm.role_principal_id = rp.principal_id)
join sys.database_principals mp on (drm.member_principal_id = mp.principal_id)')
FETCH NEXT FROM db_cursor INTO @name
END
CLOSE db_cursor
DEALLOCATE db_cursor