[¶ 1] Doug Zink and Ted Keller appeal from the district court judgment dismissing their complaint, denying their motions, and awarding Enzminger Steel attorney’s fees and costs.1 We reverse *866and remand the district court judgment dismissing Zink’s complaint with prejudice, because he was not given notice of the court’s order demanding proof of a partnership and an opportunity to respond. We also reverse and remand the dismissal of the complaint with prejudice as to Keller, and hold that the complaint is dismissed without prejudice. Finally, we reverse the district court’s award of attorney’s fees and costs to Enzminger Steel.
I
[¶ 2] Enzminger Steel contracted with Doug Zink to supply components for a new grain drying site. This contract lists Zink as the purchaser of Enzminger Steel’s materials. Zink and his son, Jeremy Zink, signed this contract. Doug Zink and Keller contend, however, that they had formed a partnership for the purposes of constructing and operating this grain drying site. They further allege that it was this partnership, not the Zinks separately, that entered into the contract with Enz-minger Steel.
[¶ 3] Sometime after construction of the grain drying site had begun, Zink and Keller allege they learned that certain unsuitable components had been used in the site’s construction. As a result, Zink and Keller refused to make any further payments under the contract to Enzminger Steel. Two separate breach of contract actions followed, one brought by Enzminger Steel and one brought by Zink and Keller. The latter action is before us on appeal. The breach of contract issues have yet to be reached, however, because this case was dismissed on procedural grounds.
[¶ 4] After the two actions had begun, Zink and Keller moved to strike Enzminger Steel’s answer and counterclaim to their complaint. Enzminger Steel moved for a protective order stemming from alleged discovery abuses, and also moved to join Jeremy Zink as a party to this action. The district court held a hearing on these motions.
[¶ 5] Keller represented himself at the hearing, but neither of the Zinks attended although they had been served notice. Doug Zink contends he did not attend because he did not oppose any of the motions scheduled to be considered at the hearing. When the hearing began, the district court immediately voiced its concern with what it felt was Keller’s unauthorized practice of law. The court criticized Keller for preparing pleadings for the Zinks and attempting to represent them, and also for the motion to strike, which the court concluded was frivolous. Keller maintained that he and Doug Zink were partners, but that his appearance in court was only on behalf of himself, not Zink or this partnership.
[¶ 6] The district court repeatedly questioned whether this alleged partnership between Zink and Keller was a ruse to allow Keller to practice law without a license. When Keller stated that he and Zink were sharing pleadings, the court responded, “That means you are practicing law without a license,” and “I know you think you are an attorney but you are not.” Keller later told the court that he and Zink had entered into an unwritten partnership agreement to share profits and losses. The court replied, “[T]he agreement that you are in is to share profits off this lawsuit which is not allowed. What they want to do is to have you be their attorney and I am not allowing that.”
[¶ 7] Despite the absence of the Zinks, the district court verbally ordered that it would dismiss the action brought by Keller and Doug Zink unless either could prove the existence of a partnership within four days. If documents were produced proving the existence of a partnership, Keller would be joined as a party to the action *867brought by Enzminger Steel. If these documents were not produced, the court stated the action brought by Zink and Keller would be dismissed and Enzminger Steel would be awarded its attorney’s fees because the pleadings were made in bad faith.
[¶ 8] Neither Zink nor Keller produced any documents proving the partnership within the time required by the court. The district court entered an order denying all of the motions in this case, and dismissed the action brought by Zink and Keller with prejudice. Additionally, Enz-minger Steel was awarded its costs and attorney’s fees because the court concluded that Zink’s and Keller’s pleadings were “made in bad faith and in blatant disregard of the law.” Judgment was subsequently entered repeating the earlier terms of the order, but updated to include monetary figures for the award of costs and attorney’s fees.
[¶ 9] On appeal, Zink and Keller argue the district court abused its discretion by denying the various motions in this case, ordering them to prove that a partnership existed, and awarding attorney’s fees and costs to Enzminger Steel. They also contend the judge was biased.
[¶ 10] The district court had jurisdiction under N.D. Const, art. VI, § 8, and N.D.C.C. § 27-05-06. The appeal is timely under N.D.R.App.P. 4(a). This Court has jurisdiction under N.D. Const, art. VI, §§ 2 and 6, and N.D.C.C. § 28-27-01.
II
[¶ 11] Zink and Keller argue the district court erred by ordering them to produce documents proving the existence of a partnership. When they did not produce these documents, the district court dismissed their complaint with prejudice.
[¶ 12] The procedure used to dismiss this case is unusual because the district court’s demand for proof of the partnership came on its own volition, not on a motion from the adverse party. We have previously upheld a district court’s ability to dismiss a case with prejudice in the absence of a motion when the complaint is inadequate. See Ennis v. Dasovick, 506 N.W.2d 386, 389 (N.D.1993) (“A trial court may, on its own initiative, and in the cautious exercise of its discretion, dismiss a complaint for failure to state a valid claim.... ”); Albrecht v. First Federal Savings & Loan Ass’n, 372 N.W.2d 893, 894-95 (N.D.1985) (district court did not err in dismissing without a prior motion a complaint that was “patently frivolous”). “This power must be exercised sparingly and with great care to protect the rights of the parties,” and “[a] trial court should dismiss under Rule 12(b) only when certain it is impossible for the plaintiff to prove a claim for which relief can be granted.” Ennis, at 389 (citations omitted). Here the district court demonstrated its concern with the possible fraud being perpetrated on the court, and demanded proof of a partnership before it would allow the proceedings to continue.
[¶ 13] The court’s oral order to Zink and Keller to produce evidence of a partnership served as the direct basis for the eventual order and judgment dismissing their complaint. The court’s order demanding proof of the partnership essentially functioned as a motion to dismiss under N.D.R.Civ.P. 12(b)(6). This order, however, demanded proof outside of the pleadings in the form of partnership documents. Under N.D.R.Civ.P. 12(d), when a motion to dismiss includes matters outside of the pleadings, then the motion is treated as one for summary judgment. See, e.g., Skogen v. Hemen Township Board, 2010 ND 92, ¶10, 782 N.W.2d 638 (dismissal without trial but with consideration of matters outside of pleadings must be treated as summary judgment); Davidson v. *868State, 2010 ND 68, ¶ 11, 781 N.W.2d 72 (district court considered matters outside of pleadings, necessitating review under summary judgment standard); Livingood v. Meece, 477 N.W.2d 183, 187 (N.D.1991) (motion to dismiss must be treated as motion for summary judgment when consideration of matters outside of pleadings is required).
[¶ 14] Accordingly, we review the district court’s dismissal under the standards for summary judgment, “which is a procedural device for promptly resolving a controversy on the merits without a trial if there are no disputed issues of material fact and inferences that can reasonably be drawn from undisputed facts, or if the only issues to be resolved are questions of law.” Davidson, 2010 ND 68, ¶ 11, 781 N.W.2d 72. “This Court reviews the evidence in a light most favorable to the opposing party and determines if summary judgment was appropriately granted as a matter of law.” Minn-Kota Ag Products, Inc. v. Carlson, 2004 ND 145, ¶ 5, 684 N.W.2d 60. Summary judgment is appropriate only when there are no genuine issues of material fact. Beckler v. Bismarck Pub. Sch. Dist., 2006 ND 58, ¶ 7, 711 N.W.2d 172.
[¶ 15] Zink and Keller were separately named parties in the complaint, and the circumstances surrounding the dismissal were different for both. Accordingly, the court’s judgment dismissing the complaint is reviewed for both Zink and Keller separately.
A
[¶ 16] Doug Zink was not present during the hearing in this case. He received notice of the hearing, but contends he did not attend because he did not oppose any of the motions scheduled to be considered. There was no prior notification that the district court was going to demand proof of Zink and Keller’s alleged partnership, or that their complaint would be dismissed if such proof was not presented. The first time this issue was raised was during the hearing itself.
[¶ 17] In City of Jamestown v. Snellman, 1998 ND 200, 586 N.W.2d 494, we considered whether or not a judge could dismiss a criminal case without a prior motion from the defendant. Noting that the question was one of first impression in the criminal context, we explored similar court action in the civil context. Citing federal precedent, we noted that “when a court dismisses an action sua sponte, it is still required to give the parties notice of its intent to do so and an opportunity to respond.” Id. at ¶ 10. Following Snellman, it is settled law in North Dakota that in both criminal and civil cases, a court seeking to dismiss a case without a prior motion from the parties must give the parties adequate notice and an opportunity to respond.
[¶ 18] Zink received no such notice or opportunity in this case. The court neither raised its concerns about the alleged partnership nor warned of the case’s imminent dismissal until during the hearing. Zink chose not to attend this hearing because he had nothing to contest. Because he chose not to attend, Zink received no direct notice of the court’s intent to dismiss the case, and he had no representation at the hearing that could have received that notice for him. Any notice given to Keller was ineffective as to Zink, because they are separately named parties to this action. See generally Anderson v. Shelton, 92 N.W.2d 166, 171 (N.D.1958) (when notice is required to be given, such notice must be provided to each individual party). No proof of the alleged partnership has been produced, and Keller is not a licensed attorney who could have properly received notice for Zink during the hearing.
*869[¶ 19] A court attempting to dismiss a civil action without a prior motion from the parties must give those parties adequate notice and an opportunity to respond. Snellman, 1998 ND 200, ¶ 10, 586 N.W.2d 494. Because Doug Zink never received adequate notice of the district court’s intentions, we reverse the judgment as to Zink and remand for further proceedings.
B
[¶ 20] Keller was present at the hearing when the district court made clear its concerns that a fictitious partnership was being used as a pretext to allow Keller to serve as Zink’s lawyer. Keller is not a licensed lawyer in the state of North Dakota. The court ordered Keller and Zink to produce evidence of the partnership within four days, and when neither did so, the case was dismissed with prejudice.
[¶ 21] The district court is afforded great latitude and discretion in conducting courtroom proceedings. Ward v. Shipp, 340 N.W.2d 14, 17 (N.D.1983). It is the judge who determines how a trial should be conducted. Id. Given this broad discretion, the court may take action to assure that any parties and counsel may properly appear at a hearing.
[¶ 22] Lacking any evidence in the record of a partnership, the district court was concerned that Keller’s appearance and his admitted sharing of pleadings with Zink constituted the unauthorized practice of law. “Commencing an action and conducting oneself in court on behalf of another qualify as the practice of law.” Wetzel v. Schlenvogt, 2005 ND 190, ¶ 10, 705 N.W.2d 836; see also N.D.C.C. § 27-11-01. The drafting of legal instruments and pleadings also qualifies as the practice of law. State v. Niska, 380 N.W.2d 646, 648 (N.D.1986). Given that Keller admitted to sharing pleadings with Zink and that he was the only one to appear at the hearing in this case, the district court had reasonable grounds for concern regarding Keller’s actions. The State has a significant interest in confining legal representation to licensed attorneys in order to protect vulnerable and uninformed parties from harm caused by unqualified persons performing legal services. Id. at 649. “Confining the practice of law to licensed attorneys is designed to protect the public from the potentially severe consequences of following advice on legal matters from unqualified persons; it is not intended to reserve to attorneys activities that may safely be conducted by laypersons.” 7 Am.Jur.2d Attorneys at Law § 119 (2011).
[¶ 23] Given the ambiguity surrounding the circumstances of this case, the district court acted within its sound discretion by requiring that some proof of a partnership be produced. Keller’s name does not appear on the contract signed with Enzminger Steel. The affidavit submitted by Enz-minger Steel’s president states that the contract was executed with Doug Zink and Jeremy Zink and that “Ted Keller was not involved with any of the project....” The court rightfully had concerns about Keller’s involvement and his potential unauthorized practice of law.
[¶ 24] We remain aware, however, that unilateral dismissal by the district court should be exercised only as a last resort. “A trial court should dismiss under Rule 12(b) only when certain it is impossible for the plaintiff to prove a claim for which relief can be granted.” Ennis, 506 N.W.2d at 389. We also note again that because the court’s oral order required proof outside the pleadings, we review the court’s dismissal under the summary judgment standard. N.D.R.Civ.P. 12(d). Rule 56(e)(2), N.D.R.Civ.P., explains the responding parties’ obligation to a motion for summary judgment:
When a motion for summary judgment is properly made and supported, an op*870posing party may not rely merely on allegations or denials in its own pleading; rather, its response must, by affidavits or as otherwise provided in this rule, set out specific facts showing a genuine issue for trial. If the opposing party does not so respond, summary judgment shall, if appropriate, be entered against that party.
Keller did not provide any evidence to establish the existence of the claimed partnership, either in the form of the documents requested by the court or by affidavit. Zink did not provide any of these documents either. Zink, however, did not have adequate notice of the imminent dismissal of this case. This fact was disposi-tive in our reversal of the dismissal of the case as it relates to Zink, and has great bearing on our decision to modify the court’s dismissal as to Keller.
[¶ 25] A recent federal case addressed an analogous situation of a self-represented plaintiff representing an unrecognized entity in court proceedings. In Chief War Eagle Ass’n & Treaty of 1837 & 1917 Reinstatement v. United States, 81 Fed. Cl. 284 (2007), a self-represented plaintiff attempted to sue on behalf of various members of his extended family. In doing so, he claimed that he was representing the “Chief War Eagle Family Association.” Id. at 235. Because the federal rules allow a self-represented plaintiff to represent only members of his immediate family, and the Chief War Eagle Family Association was not a legal entity, the United States Court of Federal Claims dismissed the plaintiffs complaint. Id. Contrary to the action taken in this ease, however, the dismissal was without prejudice and allowed for the plaintiff to refile his complaint after he had secured counsel. Id.
[¶ 26] On the basis of the circumstances of this case, we are convinced that a similar remedy should be employed here. It was reasonable for the district court to dismiss Keller’s complaint after he failed to produce evidence of a partnership. The existence of such a partnership is required because the record is currently devoid of any basis for Keller to maintain this suit against Enzminger Steel. Because Keller was both given notice that he must produce evidence of a partnership and given the opportunity to do so, dismissal was a proper remedy. A party defending against a summary judgment motion, the standard under which this dismissal is reviewed, must introduce specific facts showing a genuine issue for trial. N.D.R.Civ.P. 56(e)(2). The party opposing a motion for summary judgment “may not simply rely upon the pleadings, but must present competent admissible evidence which raises an issue of material fact.” Black v. Abex Corp., 1999 ND 236, ¶23, 603 N.W.2d 182. Keller could not rely solely on his complaint, yet he did not introduce any evidence to prove the alleged partnership exists.
[¶ 27] We are not convinced, however, that the district court could be certain it was impossible for Keller to prove his claim, as required for a dismissal in the absence of a party’s motion. See Ennis, 506 N.W.2d at 389. If a partnership really does exist in this case, it is entirely possible that proof of that partnership can be properly introduced by Zink. Zink, however, lacked notice of the impending dismissal and had no opportunity to present any evidence. Because the court did not properly allow Zink to respond to its order demanding evidence of the partnership, it could not be certain that it was impossible for Keller to prove his claim.
[¶ 28] We hold that dismissal of Keller’s claim is appropriate, but must be done without prejudice. Zink may possess evidence that would tend to prove the existence of the partnership at issue in this case. If so, Keller could be joined in the *871complaint as a required party under N.D.R.Civ.P. 19(a). Alternatively, Zink and Keller could amend their complaint under N.D.R.Civ.P. 15 to bring suit as a partnership, with the requisite leave of court or consent from Enzminger Steel. These scenarios are contingent on their offering proof of the partnership, however, which they have not yet done. Because Keller had notice of the court’s order and failed to produce evidence of a partnership as was reasonably required, his complaint is dismissed without prejudice.
III
[¶ 29] In its judgment, the district court awarded attorney’s fees and costs to Enzminger Steel, explaining that “[t]he pleadings in this action were made without reasonable cause and not in good faith and are found to be untrue.” Because the failure to give Zink proper notice of the impending dismissal of the case potentially prevented the introduction of evidence of the alleged partnership, the court erred in making its bad-faith finding. Accordingly, the award of costs and attorney’s fees to Enzminger Steel is reversed.
IV
[¶ 30] The district court has the power to dismiss a case in the absence of a party’s motion, but must provide the parties with adequate notice and an opportunity to respond. Additionally, a case may be dismissed only when the court is certain that it will be impossible for the parties to state a valid claim. Because Doug Zink did not have adequate notice or an opportunity to respond, the dismissal of his case with prejudice is reversed. Additionally, because Zink may potentially introduce evidence proving the existence of a partnership, we reverse the dismissal with prejudice of Keller’s ease and hold that Keller’s complaint is dismissed without prejudice. Any remaining issues are without merit or are otherwise unnecessary to our decision in this case, and we remand to the district court for further proceedings consistent with this opinion.
[¶ 31] GERALD W. VANDE WALLE, C.J., CAROL RONNING KAPSNER, and MARY MUEHLEN MAKING, JJ., concur.. Zink and Keller's notice of appeal attempts to appeal from the district court’s order of dismissal with prejudice, which was entered prior to the final judgment. "[Wjhen a party attempts to appeal before a final judgment or order is entered, we will treat the appeal as being from the subsequently entered consistent judgment.” In re S.L.W., 2010 ND 172, ¶ 4, 788 N.W.2d 328. Accordingly, this appeal is treated as an appeal from the district court’s final judgment.