I want to get list of all database users with specified role. Role is a parameter for stored procedure or function.
Somethinf like a select statement with user name
just depending on how you want to pass the parameter...assuming you'll use the id of the role
declare @roleID int
select
role_principal_id as roleID,
user_name(role_principal_id) as roleName,
member_principal_id as memberID,
user_name(member_principal_id) as memberName
from
sys.database_role_members
where
role_principal_id = @roleID