Here is a more generic solution. It will handle not just the underscore chars. It will work starting from SQL Server 2017 onwards.
As @Squirrel correctly mentioned, the TRANSLATE()
function is very handy for such cases.
SQL
-- DDL and sample data population, start
DECLARE @tbl TABLE (ID INT IDENTITY PRIMARY KEY, col VARCHAR(256));
INSERT INTO @tbl (col) VALUES
('2413347_6752318'),
('7263_872_767'),
('123Code456');
-- DDL and sample data population, end
SELECT col AS [Before]
, REPLACE(TRANSLATE(col, '0123456789', SPACE(10)), SPACE(1), '') AS [After]
FROM @tbl;
Output
+-----------------+-------+
| Before | After |
+-----------------+-------+
| 2413347_6752318 | _ |
| 7263_872_767 | __ |
| 123Code456 | Code |
+-----------------+-------+