title: Best Practices for storing a database schema version in SQL Server?
body: <p>I have an app which will be deployed on production PCs with SQL Server.
  I want to be able to store and retrieve a version of the schema in my database.
  I'm interested in best practices to be able to accomplish this, with the following main goals:</p>
  
  <ol>
  <li>Able to store and easily retrieve a version number of the database.</li>
  <li>Hidden or more difficult to find and manipulate by clients.</li>
  <li>Able to be edited/changed when we create a new version.</li>
  <li>Backing up the DB or detacting the DB keeps the version # for forensics.</li>
  </ol>
  
  <p>I wish there were a way to store a "version" in the metadata or not a normal table, which could be accessed/set through a system stored procedure.</p>
  
  <p>Any ideas or best practices?</p>
  
  <p>EDIT: One option I found which may be promising is to use SQL Server Extended Properties, to put a key|value assigned to the DB with "Schema_Version" and the version number.  It isn't encrypted (but the value could be), and isn't hidden, but at least is removed from the actual DB structure which some of our users and field personnel browse (to my frustration! :)  )</p>