stored proc: generalize mktemp function
it can create temporary tables that mimick any existing table