fixed sp to use temp table instead of view

view is not temporary and simultaneous process will overwrite each other