title: How to execute all views in database through stored procedure
body: <p>We have a problem with our table schema falling out of sync with our view schema. I would like to know how I could have a stored procedure (for Sql Server) that gets all views in the database, and executes each one via select *</p>
  
  <p>Here is what I imagined (pseudo):</p>
  
  <hr>
  
  <p>Declare x<br>
  Set x = Select object from sysobjects where object = view</p>
  
  <p>foreach view in x<br>
  sp_execute 'select * from view'</p>
  
  <hr>
  
  <p>We could then have an automated test that calls this every night. A SqlException would indicated that something was out of sync.</p>