I have the following SP in SQL:

```
ALTER PROCEDURE [dbo].[search_employee_special]  
 (  
 @employeruid uniqueidentifier,
 @groupuid uniqueidentifier,
 @includedependants bit = 0
 )  
AS

DECLARE @emptyuid uniqueidentifier
SET @emptyuid = CAST(CAST(0 AS BINARY) AS UNIQUEIDENTIFIER)

SELECT 
    emp.id,
    emp.name
FROM employee emp
WHERE emp.isactive = 1
  AND employeruid = @employeruid 
  AND (@groupuid = @emptyuid  OR emp.gropuid = @groupuid)

```

**This is working great** with the filters, when @groupuid is empty GUID then it doesn't filter by groupuid, otherwise it filters by groupuid...

Now, what I need is a little more complicated because I have to combine other parameter:

```
 ALTER PROCEDURE [dbo].[search_employee_special]  
     (  
     @employeruid uniqueidentifier,
     @groupuid uniqueidentifier,
     @includedependants bit = 0
     )  
    AS

        DECLARE @emptyuid uniqueidentifier
        SET @emptyuid = CAST(CAST(0 AS BINARY) AS UNIQUEIDENTIFIER)

        SELECT 
            emp.id,
            emp.name
        FROM employee emp
        WHERE emp.isactive = 1
          AND employeruid = @employeruid 
        --AND (@groupuid = @emptyuid  OR emp.gropuid = @groupuid)
          AND (
               (@includedependants = 0 AND 
                  (@groupuid  = @emptyuid 
                  OR emp.groupuid = @groupuid))    
              OR emp.specialgroupuid = @groupuid)

```

**This it not working**... what I need is that if @includedependants = 1 then it will filter emp.specialgroupuid, otherwise it will filter emp.groupuid.

Any clue on how to solve it? I'm sure its something simple :)

Appreciate the help in advance.