Can connect using SQL Server Management Studio but cannot ping or via program
If you can situationally access SQL Server over the network, this sounds like a firewall issue. To quickly test, simply turn the firewall off on myremotedb.myremotedomain.gbl first. Then, retest the application connectivity. If that doesn't work, turn the firewall of on your app server and retry connecting.

Baring that, I'd start testing ports using nmap to see which ports are able to get through to the target server. nmap is like ping but allows you to test port numbers as well. Test to see whether you can nmap port 1433 (the default sql port) from the app server to myremotedb.myremotedomain.gbl.

https://nmap.org/book/inst-windows.html