Have a look at this:
Using comma separated value parameter strings in SQL IN clauses[
^] - it doesn't do exactly what you want, but it shows you how to handle the "donkey work" of the comma separated values. You should be able to handle it from there.
[EDIT]
OK, you haven't quite got the hang of this, have you? :laugh:
delete from UserRole where RoleID = @RoleID
Won't WOrk: it returns a set of result, not a single result.
Try this:
delete from UserRole where RoleID = @RoleID
AND UserID IN (Select id from dbo.CSVToTable(@UserIDs))
Then for your INSERT:
INSERT INTO UserRole(UserID, RoleId) SELECT id, @RoleID FROM dbo.CSVToTable(@UserIDs)
[/EDIT]