Convert SQL Server results to a text file that PowerShell can access and use
This answer assumes multiple comma's are in a single row of the ServerName column, and these need to be removed &amp; Line feed + Carriage returns added instead of each comma.

There could be better ways to get your endresult, but to write to a text file without the comma's, you could use the REPLACE() function.

CHARINDEX() will only give you the location of the first value found.

CREATE TABLE [TempPSWmiObjectQuery](QueryText nvarchar(max));
INSERT INTO [TempPSWmiObjectQuery]
SELECT  REPLACE(ServerName,',',+ ' '+char(13)+char(10) )  -- Replace comma with space, line feed and carriage return.
FROM MasterList;


EXEC sp_configure 'xp_cmdshell', 1;  
RECONFIGURE;

EXEC xp_cmdshell 'bcp SQLEnv.dbo.TempPSWmiObjectQuery out "\\ServerName\Data\temp\testlist.txt" -c -T -S "ServerName\Instance"';

EXEC sp_configure 'xp_cmdshell', 0;  
RECONFIGURE;

DROP TABLE TempPSWmiObjectQuery;


Test

INSERT INTO MasterList(ServerName)
VALUES('Server1,Server2,Server3')


Result


Change SELECT REPLACE(ServerName,',',+ ' '+char(13)+char(10) ) to
SELECT REPLACE(ServerName,',',+ ' ' ) if you don't want new lines.