DECLARE @FirstUserName NVARCHAR(50)
DECLARE @NewGroupMemberUserName NVARCHAR(50)
DECLARE @GroupID DECIMAL(18,0)

SET @FirstUserName = N'jabbar'
SET @NewGroupMemberUserName = N'sonam'
SET @GroupID = 10

IF EXISTS(SELECT     dbo.tblGroupMembers.GroupID, dbo.tblUsers.IUserName
		FROM         dbo.tblGroupMembers INNER JOIN
							  dbo.tblUsers ON dbo.tblGroupMembers.UserID = dbo.tblUsers.IUserID
		WHERE     (dbo.tblGroupMembers.GroupID = 10) AND (dbo.tblUsers.IUserName = @FirstUserName))
AND NOT EXISTS(SELECT     dbo.tblGroupMembers.GroupID, dbo.tblUsers.IUserName
		FROM         dbo.tblGroupMembers INNER JOIN
							  dbo.tblUsers ON dbo.tblGroupMembers.UserID = dbo.tblUsers.IUserID
		WHERE     (dbo.tblGroupMembers.GroupID = 10) AND (dbo.tblUsers.IUserName = @NewGroupMemberUserName))
BEGIN
			INSERT INTO [tblGroupMembers]
			   ([GroupID]
			   ,[UserID]
			   ,[IsThatMemberAdmin])
			VALUES
			   (@GroupID
			   ,(SELECT     IUserID FROM         dbo.tblUsers  WHERE     (IUserName = @NewGroupMemberUserName))
			   ,0)
end				