Instead of using numbers in your sequence cte and then doing a sub-query, just use dates. You can then have the start and end dates as variables. E.g. like this
declare @startdate date = '2018-FEB-01'
declare @enddate date = '2018-NOV-10'
;WITH cte AS
(
SELECT @startdate AS num
UNION ALL
SELECT dateadd(mm, 1, num)
FROM cte
WHERE dateadd(mm, 1, num) < @enddate
)
SELECT month(num) as MonthID,
datename(month, num) as MonthName,
year(num) as [Year],
datename(m,num)+' '+cast(datepart(yyyy,num) as varchar) as MonthYearName
FROM cte
order by month(num) desc