cheapest way is to sign up with a dynamic DNS service like http://freedns.afraid.org/ - choose a subdomain you like. Then run an agent on your server to monitor when/if your public IP changes - it will send the new IP to the dynamic DNS.
If you'd prefer a paid option that uses your own domain, then some providers like Digital Ocean expose DNS settings via API. Here's a google search to get you started: https://www.google.com/search?q=dynamic+dns+host+for+digital...