DECLARE @tablofmonth AS TABLE (MONINDEX int)
INSERT INTO @tablofmonth VALUES(1)
INSERT INTO @tablofmonth VALUES(2)
INSERT INTO @tablofmonth VALUES(3)
INSERT INTO @tablofmonth VALUES(4)
INSERT INTO @tablofmonth VALUES(5)
INSERT INTO @tablofmonth VALUES(6)
INSERT INTO @tablofmonth VALUES(7)
INSERT INTO @tablofmonth VALUES(8)
INSERT INTO @tablofmonth VALUES(9)
INSERT INTO @tablofmonth VALUES(10)
INSERT INTO @tablofmonth VALUES(11)
INSERT INTO @tablofmonth VALUES(12)
DECLARE @NumOfMonth INT = 6
SELECT TOP(@NumOfMonth)* FROM @tablofmonth ORDER BY MONINDEX
CREATE PROCEDURE SELECT_MONTH(
@NumOfMonth INT
)
AS
BEGIN
SELECT TOP(@NumOfMonth)* FROM yourtable
END
GO
in the above query i have used temporary table from which i have select a number.
you just need to fire a simple select query in your store procedure as demonstrating in example
you need to replace your table name in your table name place. above sql part is just for demonstration how query works