Hi @Anonymous ,
Now that you can use the statement by SSMS and you have some problems when doing from the job. So I think the network may be the causing. In SQL Server Configuration Manager, make sure that TCP/IP is enabled for the Network protocol. If you turn on the Firewall, make sure the TCP port 1433 is in the Firewall exception list.
And you can use the following statements to check the connecting situation of your SQL.
USE master
GO
xp_readerrorlog 0, 1, N'Server is listening on'
GO
I'm not sure this can solve your problem. If this doesn't work, I will think of other ways to solve this error.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment"