Please try this,the code based on lijingyang:
;
with mycte as
(
select StudID,StudName,StudProfileRemarks, RemarksDate,trim(value) StudProfileRemark
FROM [#StudProfileReviewer]
cross apply openjson('["'+(replace(StudProfileRemarks,'|','","')+'"]'))
),mycte1 AS
(
select StudID,StudName,StudProfileRemarks, RemarksDate, StudProfileRemark,S.a.value('(/H/r)[1]', 'VARCHAR(100)') AS Remarksplit_item1
,S.a.value('(/H/r)[2]', 'VARCHAR(100)') AS Remarksplit_item2,S.a.value('(/H/r)[3]', 'VARCHAR(100)') AS Remarksplit_item3
FROM
(
SELECT *,CAST (N'<H><r>' + REPLACE(StudProfileRemarks, '|', '</r><r>') + '</r></H>' AS XML) AS [vals]
FROM mycte
) d
CROSS APPLY d.[vals].nodes('/H/r') S(a)
)
Select StudID, StudName, StudProfileRemarks, RemarksDate ,
Remarksplit_item1,Remarksplit_item2,Remarksplit_item3,
Max(Case when StudProfileRemark = 'NameMistake' then 'NameMistake' else '' end) RemarksSplit_NameMistakes
,Max(Case when StudProfileRemark = 'Mobile Phone No length mistake' then 'Mobile Phone No length mistake' else '' end) RemarksSplit_MobilePhoneMistakes
,Max(Case when StudProfileRemark = 'DOB Mistake' then 'DOB Mistake' else '' end) RemarksSplit_DOBMistakes
,Max(Case when StudProfileRemark = 'AddressMistake' then 'AddressMistake' else '' end) RemarksSplit_AddressMistakes
,Max(Case
when StudProfileRemark <> 'NameMistake'
and StudProfileRemark <> 'Mobile Phone No length mistake'
and StudProfileRemark <> 'DOB Mistake'
and StudProfileRemark <> 'AddressMistake'
and StudProfileRemark <>''
then StudProfileRemark else '' end) RemarksSplit_OtherMistakes
, Max(Case when StudProfileRemark = 'NameMistake' then 1 else 0 end)
+ Max(Case when StudProfileRemark = 'Mobile Phone No length mistake' then 1 else 0 end)
+ Max(Case when StudProfileRemark = 'DOB Mistake' then 1 else 0 end)
+ Max(Case when StudProfileRemark = 'AddressMistake' then 1 else 0 end)
+ Max(Case
when StudProfileRemark <> 'NameMistake'
and StudProfileRemark <> 'Mobile Phone No length mistake'
and StudProfileRemark <> 'DOB Mistake'
and StudProfileRemark <> 'AddressMistake'
and StudProfileRemark <>''
then 1 else 0 end) cnt
from mycte1 t
Group by StudID, StudName, StudProfileRemarks, RemarksDate ,Remarksplit_item1,Remarksplit_item2,Remarksplit_item3
Bert Zhou