I assume that when you say "run code everytime the module is added to a container", you mean when the module is added to a page by using the "Add New Module" commands in the control panel.
If so, the best way to check if this is a new instance of the module is to check (usually in the Page_Load handler of the view control) with the following code:
If Me.Settings.Count = 0 Then
'Run code to check if profile exists and create if necessary
'Pre-configure module settings with at least one setting so that this code will not run next time.
End If
In the unlikely case that your module will not be adding at least one setting key/value to the ModuleSettings table, you will need to set one as follows:
Dim mc As New Entities.Modules.ModuleController()
mc.UpdateModuleSetting(Me.ModuleId, "Initialized", "True")
I generally create a class for the module's configuration, returning each setting as a strongly typed property and providing for loading and saving the configuration from/to ModuleSettings or TabModuleSettings as appropriate. In most cases, I include code such as the above to determine if the module has been initialized to both pre-configure the settings to default values and to run once any custom code.