title: How to get database name automatically into script to use in stored procedure execution?
body: <p>I need to TRIM databases as per requirement. So, I'm using below script and giving database names manually. All I need is to automate the script to get database names automatically. Can anyone please suggest how to get the database name automatically.</p>
  
  <pre><code>Use [Sales_backup_2015_05_31_230001_7137975]
  Exec [spMaint_TrimTestDB] 1
  Go
  </code></pre>
  
  <p>for Eg: 
  instead of giving manually <code>Sales_backup_2015_05_31_230001_7137975</code> I need to get db name automatically</p>
  
  <p>Thanks.</p>