Microsoft ODBC Driver 11 for SQL Server: Named Pipes Provider: Could not open a connection to SQL Server
Not knowing the full details of your issue by your question try the following:

Option 1:

Temporarily disable Windows Firewall and test your SQL script once more:



Option 2:

Make sure NetBIOS is enabled in the TCP/IP settings of the network adapter you are using:



Option 3:

Ensure that SQL Server protocols are enabled through SQL Server Configuration Manager:



Option 4:

Try a combination of two or more options above.