If I understand correctly the date is stored in a a varchar column and taken that this is SQL Server. If that is the case, one easy way is to convert it to date and then do the comparison. For example
...
AND DATEPART(year, CONVERT(date, PostMonth, 105)) = @year
AND DATEPART(month, CONVERT(date, PostMonth, 105)) = @month
...
However, the actual correction would be to store the date inside a date column instead. This would make it a lot easier to do the comparison and wuold leave out all unnecessary conversions. The same applies to the variables since it seems that you have used varchar for them even though they are actually numbers.