title: Using SELECT result as string_pattern in REPLACE function
body: <p>On SQL Server 2019, I would like to write a Scalar-value Function returning a string stripped from a series of possible substrings.</p>
  <p>Assuming all of the substrings I want to replace with <code>''</code> are in table <code>MY_TABLE</code>, in column <code>MY_SUBSTRINGS</code>, what would be the most efficient way to use the results of <code>SELECT MY_SUBSTRINGS FROM MY_TABLE</code> as string patterns in a <code>REPLACE</code> function to strip <code>@MyString</code> from the substrings.</p>
  <p>Should I store the result of the <code>SELECT</code> in a table variable and loop through each of the substrings and call <code>REPLACE</code> for each substring possibilities or is there a better way to do this?</p>