If I have a coded sql query I want to run before a test and also use the returned values (ID and Company) to "dynamically" set the local data so that the test will run multiple iterations against the values
You can achieve this in code and with some small test adjustments. I created a sample Test Studio project and you can find more details on the necessary steps below.
Create a test and add empty local data table with the required columns and rows. You can rename the columns (see emptyLocalData.png).
Record the necessary steps and data bind the ones you need. I did it for step 5 in the sample test.
Add a coded step to set the results from SQL query to a collection. You need to declare the collection as static in the test's class, which will hold the results from the SQL query. In my example I used a List<string> to create a simple scenario.
Add another coded step before you use the local data in your test. Here is when you need to overwrite the empty local data values with the ones from the static collection. Please check the sample code in step 4 for more details.
I hope this help you with the scenario at hand. If you need further assistance, please share more details about the test and code you currently have.