This is my stored procedure so far

```
ALTER PROC [dbo].[getItems]
  (
    @EventId int,
    @OrgUserId int
  ) AS

BEGIN

DECLARE @BoardBookId int;
SET @BoardBookId = (SELECT bb.BoardbookId FROM Boardbook bb WHERE bb.ItemId = @EventId);

WITH PermissionDeniedAttachments AS
(
    SELECT bbi.CategoryItemId
    FROM BoardbookItem bbi 
    INNER JOIN CategoryItem ci ON ci.CategoryItemId = bbi.CategoryItemId
    WHERE bbi.BoardbookId = @BoardBookId AND bbi.CategoryItemId > 0 AND ci.catID NOT IN (SELECT catID from dbo.f_Categories(@OrgUserId))
)
SELECT 
    bbi.BoardbookId,
    bbi.BoardbookItemId,
    bbi.CategoryItemId,
    bbi.ChBy,
    bbi.ChDt,
    bbi.CrBy,
    bbi.CrDt,
    bbi.DeletedBy,
    bbi.DeletedDt,
    bbi.Description,
    bbi.Duration,
    bbi.ParentBoardbookItemId,
    bbi.SortOrder,
    bbi.Title,
    bbi.Resolutions,
    bbi.Presenter,
    bbi.BoardbookItemType,
    u1.Name_FirstLast as [ItemCreatedByName],
    u2.Name_FirstLast as [ItemChangedByName],
    CAST(CASE WHEN ci.deletedDt IS NULL THEN 0
                      ELSE 1 END AS BIT) AS Deleted,
    i.itemType as [DocType],
    ISNULL(ci.catID, 0) AS CatId,
    ISNULL(ci.itemID, 0) AS ItemId,
    d.docID as docId,
    d.docPages as DocPages,
    d.docPwdProtected AS HasPassword,
    bbi.BoardbookItemTypeCustom
from BoardbookItem bbi 
LEFT JOIN Users u1 on u1.UserName=bbi.CrBy
LEFT JOIN Users u2 on u2.UserName=bbi.ChBy
LEFT OUTER JOIN CategoryItem ci ON bbi.CategoryItemId IS NOT NULL AND bbi.CategoryItemId = ci.CategoryItemId
LEFT JOIN Item i ON ci.itemID = i.itemID
LEFT JOIN Documents d on d.docID = bbi.DocId
          where bbi.BoardbookId=@BoardBookId  AND bbi.DeletedDt IS NULL AND 
        (bbi.CategoryItemId IS NULL OR bbi.CategoryItemId NOT IN (Select CategoryItemId from PermissionDeniedAttachments)) 

```

Now what I want is to put a `var @submenuitem bit` and test it...
So, if `@submenuitem = 0` I will have as response the same effect that I am getting now, 
but if `@submenuitem = 1` I want to have one more check in the "where" for ex.
`'AND bbi.ParentBoardbookItemId='0'`

It seems that it is possible to be done with `IF ELSE` statements BUT unfortunately I can not do it the right way 

Thank you in advance!