(1) Examine solution to [this question]
(T-SQL split string) - copy the split string function over. TSQL does not have a native function to do this if you are using anything older than 2016.
CREATE FUNCTION dbo.splitstring ( @stringToSplit VARCHAR(MAX) )
RETURNS
@returnList TABLE ([Name] [nvarchar] (500))
AS
BEGIN
DECLARE @name NVARCHAR(255)
DECLARE @pos INT
WHILE CHARINDEX(',', @stringToSplit) > 0
BEGIN
SELECT @pos = CHARINDEX(',', @stringToSplit)
SELECT @name = SUBSTRING(@stringToSplit, 1, @pos-1)
INSERT INTO @returnList
SELECT @name
SELECT @stringToSplit = SUBSTRING(@stringToSplit, @pos+1, LEN(@stringToSplit)-@pos)
END
INSERT INTO @returnList
SELECT @stringToSplit
RETURN
END
see: T-SQL split string for original answer.
(2) Then do:
select sourcetbl.id, a.[Name] as columnValue , row_number() over (partition by BusinessEntityID order by (select 1)) as columnPosition
from sourcetbl
cross apply dbo.splitstring(joined_data) a;
you will get something like this:
Id | columnValue | columnPosition
1 | 5 | 1
1 | 47 | 2
1 | F | 3
2 | 2 | 1
2 | 5 | 2
2 | A | 3
Then pivot by ID and columnPosition to generate desired table.