In some cases, anxiety medication prescribed by a veterinarian can help reduce excessive whining in dogs. However, medication should always be used under professional guidance and as part of a comprehensive treatment plan that may include behavior modification techniques.