There are a few functions designed to help you when dealing with instance or global variables (primarily for use with Compatibility Scripts for imported projects and the code for Drag and Drop actions, but they can be used elsewhere too):
variable_instance_exists variable_instance_get_names variable_instance_names_count variable_instance_get variable_instance_set variable_global_exists variable_global_get variable_global_set