From what I am understanding you have a Sitefinity page, where you have used its CodeBehindType property to set a code behind file. In the code behind file (probably Page_Load event) you are using API to get your legacy content and store it in Sitefinity. Is this assumption correct so far?
In your last reply I can see that you are using DynamicContent type, which is the type used by modules created through Module builder, so I assume you are storing the legacy content into a Dynamic module (from Module builder).
It is important to note here that DynamicContent type does not have CodeBehindType property for it is a model type of object.
Can you tell me on which page have you placed the automatically generated widget for your Dynamic module? If it is placed on the page which you use to import content, please move it to a different page and see if the code is executed again when you preview.
If it still does, then go to Content->Your module->Pages where items like this are published. If the page which you use to import content is at the top of the list with priority 1, move it to the bottom (using the Actions menu).
More information on this can be found here:
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal
and vote to affect the priority of the items