• -- use APPLY to evaluate your filters

    SELECT *

    FROM table1

    CROSS APPLY (

    SELECT

    Filter1 = CASE

    WHEN @con = 0 AND YEARMONTH >= REPLACE(@YearMonth,'-','') THEN 1

    WHEN YEARMONTH <> REPLACE(@YearMonth,'-','') THEN 2

    ELSE NULL END,

    Filter2 = CASE

    WHEN @con = 0

    AND CONVERT(datetime, RDATE, 103) >= convert(datetime, @dt3, 103)

    AND CONVERT(datetime, MD.RDATE, 103) <= convert(datetime, @dt4, 103) THEN 1

    WHEN CONVERT(datetime, RDATE, 103) >= convert(datetime, @dt1, 103)

    AND CONVERT(datetime, MD.RDATE, 103) <= convert(datetime, @dt2, 103) THEN 2

    ELSE NULL END

    ) x

    WHERE id = @id

    AND imtid <> 0

    -- and to check they work as you expect them to

    SELECT *

    FROM table1

    CROSS APPLY (

    SELECT

    Filter1 = CASE

    WHEN @con = 0 AND YEARMONTH >= REPLACE(@YearMonth,'-','') THEN 1

    WHEN YEARMONTH <> REPLACE(@YearMonth,'-','') THEN 2

    ELSE NULL END,

    Filter2 = CASE

    WHEN @con = 0

    AND CONVERT(datetime, RDATE, 103) >= convert(datetime, @dt3, 103)

    AND CONVERT(datetime, MD.RDATE, 103) <= convert(datetime, @dt4, 103) THEN 1

    WHEN CONVERT(datetime, RDATE, 103) >= convert(datetime, @dt1, 103)

    AND CONVERT(datetime, MD.RDATE, 103) <= convert(datetime, @dt2, 103) THEN 2

    ELSE NULL END

    ) x

    WHERE id = @id

    AND imtid <> 0

    AND x.Filter1 = 1

    AND x.Filter2 = 2

    -- when you are absolutely sure everything is working as it should,

    -- you can switch the filters back to the WHERE clause. You don't have to.

    -- The execution plan is likely to be identical and retaining the APPLY block

    -- aids readability.

    SELECT *

    FROM table1

    WHERE id = @id

    AND imtid <> 0

    AND (CASE

    WHEN @con = 0 AND YEARMONTH >= REPLACE(@YearMonth,'-','') THEN 1

    WHEN YEARMONTH <> REPLACE(@YearMonth,'-','') THEN 2

    ELSE NULL END) = 1

    AND (CASE

    WHEN @con = 0

    AND CONVERT(datetime, RDATE, 103) >= convert(datetime, @dt3, 103)

    AND CONVERT(datetime, MD.RDATE, 103) <= convert(datetime, @dt4, 103) THEN 1

    WHEN CONVERT(datetime, RDATE, 103) >= convert(datetime, @dt1, 103)

    AND CONVERT(datetime, MD.RDATE, 103) <= convert(datetime, @dt2, 103) THEN 2

    ELSE NULL END) = 2

    -- WARNING: using functions on your table columns will almost always prevent

    -- SQL Server from using an index on those columns, resulting in suboptimal performance.

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden