New stored procedure that facilitates creating views of formlet data.  Takes 3 parameters:  GUID of the FormTemplate, bit indicating to show available columns (0 is show columns, 1 is create the view query), and a list of columns (separated by line breaks).  The last parameter is nullable and separating by line breaks facilitates copying and pasting selected InputItemCodes as column names directly from the output of the query where the bit flag was set to 0.

The resulting views do not handle MultiSelects or Repeatable InputItems.
using correct map table
minor changes
Leading zeros map and other changes
insignificant change
Only where LegaccySpedCode is not null.  Please advise if issues are encountered due to this change.
removed insignificant duplicate line.
Add IepEsy to loadtable and loadcolumn.
Corrected IF EXISTS for GoalAreaPivotView