WITH Tally(n) AS( SELECT TOP 11 ROW_NUMBER() OVER(ORDER BY (SELECT NULL)) - 1 FROM sys.all_columns)SELECT n, CASE WHEN n % 2 = 1 THEN 'Odd' ELSE 'Even' END FROM Tally

CREATE FUNCTION ODD_or_Even( @Digit int)RETURNS table with schemabindingAS return select case when @Digit % 2 = 0 then 1 else 0 end as IsEven

create procedure GetOddOrEvenValues( @NumResults int) asWITH E1(N) AS (select 1 from (values (1),(1),(1),(1),(1),(1),(1),(1),(1),(1))dt(n)), E2(N) AS (SELECT 1 FROM E1 a, E1 b), --10E+2 or 100 rows E4(N) AS (SELECT 1 FROM E2 a, E2 b), --10E+4 or 10,000 rows max cteTally(N) AS ( SELECT ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) FROM E4 )select *from cteTally tcross apply dbo.ODD_or_Even(t.N)where t.N <= @NumResults

exec GetOddOrEvenValues 123 --change the 123 to any positive number and it will return that many rows.