Unless the developer of the code expressly states in the contract of sale, the code belongs to them.
If you commission a project and employ a programmer to do a job, you own the product / code that they produce.
The difference is that in the first example you are buying off the shelf code, the other you are having bespoke work done under a contract that you will then own.
Non-disclosure agreements are mainly used for inventors or people who have developed a product that they then tout to the major corporations and venture capitalists.
What you need is a contract of employment where you state clearly that you are employing the developer to do specific jobs and that what is developed becomes your property... This is how Edison did business, the man never invented a single thing he has credit for, it was the thousands of people under him that did all the grunt work and innovation that Edison then claimed credit for.