This might just be a problem with how you're [not] storing the results from each iteration through the for loop. What if you repeatedly update the same string, called test
below, to end up with a single, fully-updated string?
test <- SQLSegmented[1]
for (i in 1:ncol(SplitOnComma))
{
cat(SplitOnComma[1,i])
cat(SplitOnComma[2,i])
test = gsub(SplitOnComma[2,i], SplitOnComma[1,i], test)
}
test