class CallStoredProc
  def initialize(procedure_name, args = {})
    @procedure_name = procedure_name
    @args = args
  end

  def call
    params_sql = @args.map { |key, value| "@#{key} = :#{key}" }.join(', ')
    sql_template = "EXEC #{@procedure_name} #{params_sql}"
    sanitized_sql = VhcsRecord.send(:sanitize_sql_array, [sql_template, @args])
    
    VhcsRecord.connection.exec_query(sanitized_sql)
  end
end
