Executing functions and declaring flags with a long battery of if conditions
This is bad.  Very bad.

It appears the original implementer doesn't quite understand arrays.  You should definitely refactor this.  Michael K's answer has the right approach.  In C# syntax:

// Hopefully these variables are already in an array or list already, otherwise:
MyType[] myVariables = new MyType[] { varOne, varTwo, /* ... */ varEight };

foreach (MyType variable in myVariables)
{
    if (variable == flag)
    {
        run_some_sql();
        set_some_flag = true;
    }
}


Note that if run_some_sql() only needs to be executed once, you can break out early and save some computation time:

foreach (MyType variable in myVariables)
{
    if (variable == flag)
    {
        run_some_sql();
        set_some_flag = true;

        break;
    }
}


If it is the case that you only need to execute run_some_sql() once, you can make the code even simpler using new LINQ syntax:

if (myVariables.Any(v =&gt; v == flag))
{
    run_some_sql();
    set_some_flag = true;
}


While refactoring, I'd also recommend choosing some better variable names than varOne, varTwo, flag, etc.  Though I assume these are just your examples. :)