I think I'm following you, and it seems to me that the only thing you need the dynamic name for is the placeholder.
foreach ($tv_array as $id=>$var)
{
$tvr = $modx->getObject('modTemplateVarResource', array(
'tmplvarid' => $id,
'contentid' => $companyPageId
));
if ($tvr) { /* added sanity check in case of bad $tv_array values */
$modx->SetPlaceholder('profile' . $var, $tvr->get('value);
}
}
Using dynamic variable names is possible in PHP, but it's a nightmare to maintain. I don't think I've never seen an example in good production PHP code. I've done it once or twice, but in retrospect, it's always been a mistake. If the code above doesn't work for you, I'd recommend creating a new array in the loop and using that.
Something else to think about: If there's a way to get the data in one query to the DB rather than 17 separate ones, it would speed things up a lot.
This would get all the Tvrs in one query:
$modx->getObject('modTemplateVarResource', array(
'contentid' => $companyPageId,
));
If that gets too many, you could restrict it by doing something like this:
$query->where(array(
'contentid' => $companyPageId,
'tmplvarid:IN' . array_keys($tv_array),
));
Then, it might be possible to walk through the resulting array of Tvrs and set the placeholders.