The proc_SecListUsersInRole stored procedure lists the non-deleted principals assigned to a specified role in the specified scope.

 PROCEDURE proc_SecListUsersInRole(
       @SiteId                        uniqueidentifier,
       @ScopeId                       uniqueidentifier,
       @RoleId                        int,
       @RequestGuid                   uniqueidentifier

@SiteId: The site collection identifier (section of the site collection containing the scope, role, and principals to be listed.

@ScopeId: The scope identifier (section of the scope within which to match principals assigned to the role.

@RoleId: Specifies the role identifier of the role definition assigned to the principals to be listed.

@RequestGuid: The optional request identifier for the current request.

Return Values: The proc_SecListUsersInRole stored procedure returns an integer return code which MUST be 0, and MUST return one result set.