• i got it using

    where id=@id

    and (

    (@con=0 AND YEARMONTH >=Replace(@YearMonth,'-',''))

    OR (@con<>0 AND YEARMONTH <>Replace(@YearMonth,'-',''))

    )