AMPscript is evaluated on the server side at send-time. So it is evaluated for every preview of the email as well as every email sendout. Opens don't re-process AMPscript.
The system processes the script at the point where you include it in the message to render content on a subscriber-by-subscriber basis. The Marketing Cloud application handles all AMPscript calls at the end of the email send.
(Source: Introduction to Programmatic Marketing Content)
If you need to exclude Test sends, you can retrieve the context of the message and don't execute the CreateSalesforceObject-call for tests.
IF (_messagecontext != "PREVIEW" AND _isTestSend != true) THEN