Cross Join with Filter? i need to make Sp to distribute students to their sections the procedure take 2 string parameters StuID and SecID

in case I've send '1,2,3,4,5' as StuID and 'a,b' as SecID i'm using spliting function which well return tables

Tb1 |   Tb2
1   |    a
2   |    b
3   |
4   |  
5   |


how can i get the following result

1 a
2 b
3 a
4 b
5 a
....


I've tried to do it via cross join but it did not show the result i want

select US.vItem as UserID,SE.vItem as Section 
from split(@pUserID,',') us 
cross join split(@pSectionID,',') se
you can do it by following

CREATE TABLE #Temp(id int)

insert into #Temp values(1),(2),(3),(4),(5),(6),(7),(8),(9),(10)

CREATE TABLE #Temp2(val varchar(2))

insert into #Temp2 values('a'),('b'),('c')

--Get temp table using split funtion

DECLARE @var int 
SELECT @var = COUNT(0)FROM #Temp2

;WITH 
    CTE AS (SELECT ROW_NUMBER()OVER(ORDER BY ID)AS SNO,* FROM #Temp),
    CTE2 AS (SELECT ROW_NUMBER()OVER(ORDER BY val)AS SNO,* FROM #Temp2) 
SELECT * FROM Cte c JOIN CTE2 d ON d.SNO= CASE WHEN c.Sno%@var = 0 THEN @var ELSE c.SNO%@var END 
ORDER BY c.SNO
;

DROP TABLE #Temp
DROP TABLE #Temp2