Pues efectivamente he conseguido hacerlo con una consulta programada, me olvido de hacer un módulo... la consulta por si interesa a alguien es esta:
DECLARE @intuserid INT
DECLARE @Contador INT
SET @Contador = (SELECT count(Users.UserID)
FROM Users INNER JOIN
UserProfile ON Users.UserID = UserProfile.UserID INNER JOIN
ProfilePropertyDefinition ON UserProfile.PropertyDefinitionID = ProfilePropertyDefinition.PropertyDefinitionID
WHERE (ProfilePropertyDefinition.PropertyName = N'Profesional') AND (UserProfile.PropertyValue = N'True') And Users.UserID not in (select UserID from UserRoles where UserRoles.RoleID=3) AND (Users.UserID NOT IN
(SELECT UserID
FROM UserRoles
WHERE (RoleID = 3))))
while @contador > 0
begin
set @intuserid = (SELECT top 1 Users.UserID
FROM Users INNER JOIN
UserProfile ON Users.UserID = UserProfile.UserID INNER JOIN
ProfilePropertyDefinition ON UserProfile.PropertyDefinitionID = ProfilePropertyDefinition.PropertyDefinitionID
WHERE (ProfilePropertyDefinition.PropertyName = N'Profesional') AND (UserProfile.PropertyValue = N'True') And Users.UserID not in (select UserID from UserRoles where UserRoles.RoleID=3) AND (Users.UserID NOT IN
(SELECT UserID
FROM UserRoles
WHERE (RoleID = 3))))
insert into UserRoles values(@intuserid,3,null,null,null)
set @Contador = @Contador-1
continue
end
SET @Contador = (SELECT count(Users.UserID)
FROM Users INNER JOIN
UserProfile ON Users.UserID = UserProfile.UserID INNER JOIN
ProfilePropertyDefinition ON UserProfile.PropertyDefinitionID = ProfilePropertyDefinition.PropertyDefinitionID
WHERE (ProfilePropertyDefinition.PropertyName = N'Profesional') AND (UserProfile.PropertyValue = N'False') AND (Users.UserID IN
(SELECT UserID
FROM UserRoles
WHERE (RoleID = 3))))
while @contador > 0
begin
set @intuserid = (SELECT top 1 Users.UserID
FROM Users INNER JOIN
UserProfile ON Users.UserID = UserProfile.UserID INNER JOIN
ProfilePropertyDefinition ON UserProfile.PropertyDefinitionID = ProfilePropertyDefinition.PropertyDefinitionID
WHERE (ProfilePropertyDefinition.PropertyName = N'Profesional') AND (UserProfile.PropertyValue = N'False') AND (Users.UserID IN
(SELECT UserID
FROM UserRoles
WHERE (RoleID = 3))))
delete from UserRoles where userid = @intuserid and RoleID = 3
set @Contador = @Contador-1
continue
end