And another solution using nested REPLACE.
WITH PartialNames AS (
SELECT * FROM (VALUES('first,,'),('first,,last'),(',middle,last')) d (PartialName)
)
SELECT REPLACE( REPLACE( RTRIM( LTRIM( REPLACE( PartialName, ',', ' '))), ' ', ','), ',,', ',')
FROM PartialNames