That will work in the US, not sure about internationally. Also, it has to be done every time you make a call.
For a more permanent solution, depending on the device you use, if you open your phone app, then look in the settings within the phone/dialer, there sometimes is an option to hide your number or make it private. This will make it private for all calls until you change it back.
If your device doesn't have a setting like that, you can probably call your carrier and ask them to make your phone number private.