Quick thought, this can be simplified with the charindex function, no need to actually split the input. The focus must be on what has to be done, not how;-)
😎
DECLARE @reportID VARCHAR(10) = '0,1,'
IF CHARINDEX(',0,',',' + @reportID + ',') = 0
BEGIN
SELECT 'Students report 1' AS selectRptName, 1 AS rptNumValue
UNION
SELECT 'Students report 2', 2
UNION
SELECT 'Students report 3', 3
UNION
SELECT 'Students report 4', 4
UNION
SELECT 'Students report 5', 5
ORDER BY selectRptName
END
ELSE
SELECT 'Report 0' AS selectRptName,0 AS rptNumValue