I think you can do the same with the below procedure. I hope that you need to change the old code to a new code, as I understood from the question.
For this, you need to "Import old ad code" to to the new code by replacing it. Once you know the old ad code, need to sign in your adsence account. You have to click on "my ads" button and then you can see the "content" section. Under that, you can see" add units". The right side then you can see as "Import old ad code" button. Press that button. then you will direct to another page.
In this page, in the centre, you can paste your old add. Also in the top left side, you need to create a new AdSense unit name. Then press the "import" button in the left bottom side. Finally, Replace the old code in your pages with the newly generated code and publish your site to see the new ads.
Hope by this can be solve your issue.
Winners are too busy to be sad,too positive to be doubtful,too optimistic to be fearful and too determined to be defeated.