Here's a different method that might work well. Should we start testing? 😀
DECLARE @code nvarchar(4000) = '12333345566689';
with seed1 (a)
as
(
select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all
select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1
),
numbers (n) as
(
select top (LEN(@code)) row_number() over (order by (select null))
from seed1 s1, seed1 s2, seed1 s3
)
select a.b.value('(./text())[1]', 'nvarchar(4000)') as [text]
from (
select CASE WHEN SUBSTRING( @code, n, 1) = SUBSTRING( @code, n - 1, 1) THEN ''
ELSE SUBSTRING( @code, n, 1) END
FROM numbers
for xml path (''), type
)a(b)