Hi @mo boy ,
Please enable Named Pipes protocol for MSSQL server instance when your SQL server connection using Named Pipes protocol.
Your SQL server instance connection succeed sometimes, the connection may use TCP/IP protocol instead of Named Pipes protocol.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".