Please try the following solution.
SQL
-- DDL and sample data population, start
DECLARE @tbl TABLE (ID INT IDENTITY PRIMARY KEY, list NVARCHAR(255));
INSERT INTO @tbl (list) VALUES
('A_505,A_987'),
('A_999,A_123,A_999,A_123'),
('');
-- DDL and sample data population, end
DECLARE @separator CHAR(1) = ',';
;WITH rs AS
(
SELECT ID
, TRY_CAST('<root><r>' +
REPLACE(list, @separator, '</r><r>') +
'</r></root>' AS XML) AS xmldata
FROM @tbl
)
SELECT rs.ID
, REPLACE(rs.xmldata.query('
for $x in distinct-values(/root/r/text())
return fn:substring($x,3, 10)
').value('.','VARCHAR(255)'), SPACE(1), @separator) AS list
FROM rs;
Output
+----+---------+
| ID | list |
+----+---------+
| 1 | 505,987 |
| 2 | 999,123 |
| 3 | |
+----+---------+