Ideally you'll have v17 or higher of RSLogix 5000 and ControlLogix firmware.
v17 introduced the XML based import/export file format, and it's very simple, safe, and reliable to import an entire Routine and all of its tags during runtime in v17.
In v16 and earlier, you could create Tasks, Programs, and Routines at runtime, but importing logic was a copy-paste process.