If you mean a database query, this is really hard to do reliably. The time spent on a query affected by several factors like the plan, server workload, network traffic and so on.
Typically a marquee type if indicator is used to inform the user that the operation is running but the time estimate is unknown. Depending on the technology you use, the progress bar element differs.
For example Forms has
ProgressBar[
^] where you can set the
Style[
^] to Marquee.