I have the following Split
function,
ALTER FUNCTION [dbo].[Split](@String varchar(8000), @Delimiter char(1))
returns @tempt
declare @Version nvarchar(3000)
declare @Delimiter char(1) = ','
declare @result nvarchar(3000)
set @Version = 'Terça-feira, Quarta-feira, Sexta-feira, Segunda-feira';
with V as (select value v, Row_Number() over (order by (select 0)) n
from String_Split(@Version, @Delimiter)
)
SELECT @result = STUFF((SELECT ', ' + RTRIM(LTRIM(v))
FROM V
ORDER BY CASE RTRIM(LTRIM(v))
WHEN 'Segunda-feira' then 1
WHEN 'Terça-feira' then 2
WHEN 'Quarta-feira' then 3
WHEN 'Quinta-feira' then 4
WHEN 'Sexta-feira' then 5
END FOR XML PATH('')), 1, LEN(@Delimiter), '')
PRINT @result